
<div id="register" class="login_wrapper">
<div class="animate form login_form">
    <section class="login_content">
        <form action="javascript:void(0)">
            <h1>**管理系统注册</h1>
            <div>
                <input type="text" v-model="user.userName" class="form-control" placeholder="Username" required="" />
            </div>
            <div>
                <input type="text" v-model="user.email" class="form-control" placeholder="Username" required="" />
            </div>
            <div>
                <input type="password" v-model="user.password" class="form-control" placeholder="Password" required="" />
            </div>


            <div>
                <a @click="register()" class="btn btn-default submit" href="javascript:void(0)">注册</a>
                <a class="reset_pass" href="#">Lost your password?</a>
            </div>

            <div class="clearfix"></div>

            <div class="separator">
                <p class="change_link">New to site?
                    <a href="/login" class="to_register"> Login in </a>
                </p>

                <div class="clearfix"></div>
                <br />

                <div>
                    <h1><i class="fa fa-paw"></i>  Java_Spring_Boot</h1>
                    <p>©2016 All Rights Reserved. Using is a Bootstrap 3 template.</p>
                </div>
            </div>
        </form>
    </section>
</div>
</div>


<script>
    var loginVue=new Vue({
        el:"#register",
        data:{
            user:{
                userName:"",
                email:"",
                password:"",
                rememberMe:false,
                verificationCode:""
            }
        },
        methods:{
            register:function () {
                if (this.user.userName==""||this.user.password==""||this.user.email==""){
                    layer.msg("Please input user name and password",{icon:0})
                    return;
                }
                var self=this;
                $.ajax({
                    url:"/api/user",
                    type:"post",
                    contentType:"application/json",
                    data:JSON.stringify(self.user),
                    success:function (rs) {
                        if (rs.status==200){
                            window.local.href="/common/dashboard";
                        }else{
                            console.log(rs.status)
                            layer.msg("rs.message",{icon: 0});
                        }
                        self.cities=rs;
                    },
                    error:function (data) {
                        layer.alert(data.responseText,{icon:0});
                    }
                });
            }
        },


    })
</script>
